package main

import (
	"fmt"
	"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
	Use:   "myapp",
	Short: "My Application",
	Long:  `A longer description of my application.`,
}

var myFlag string

func run(cmd *cobra.Command, args []string) {
	fmt.Println("myflag:", myFlag)
}

func main() {
	//go run .\main.go myapp --myflag czc1
	//go run .\main.go myapp --myflag=czc2
	//go run .\main.go myapp -m czc3
	//go run .\main.go myapp -m czc4
	rootCmd.Flags().StringVarP(&myFlag, "myflag", "m", "default", "A description of my flag")
	rootCmd.Run = run
	rootCmd.Execute()
}
